using System;
using System.Collections.Generic;
using System.Text;
using Presentation.Contracts;
using System.Web.UI;
using Task.Contracts;
using Task;
using DataAccess;

namespace Presentation
{
    public class UserLogInArtPresenter 
    {
        #region Members

        /// <summary>
        /// Instance of view.
        /// </summary>
        private IUserLogInArtView view;

        /// <summary>
        /// 
        /// </summary>
        private IArtTask artTask;

        private ITagTask tagTask;

        #endregion Members

        #region Construction/Finalization

        /// <summary>
        /// Initializes a new instance
        /// </summary>
        /// <param name="view">The view.</param>
        public UserLogInArtPresenter(IUserLogInArtView view)
        {
            this.view = view;
            this.artTask = new ArtTask();
            this.tagTask = new TagTask();
        }

        #endregion Construction/Finalization

        public void ReadArtByArtId(int idArt)
        {
            art artTmp = artTask.ReadArtByArtId(idArt);
            if (artTmp == null)
            {
                view.DisplayError("Podano niepoprawny numer publikacji");
            }
            else
            {
                tagTask.ReadTagsByArtId(idArt);
            }
        }
    }
}
